package com.cheng.example.geektime.designpatterns.j57;


/**
 * 发放新的用户体验金
 */
public class RegPromotionObserver implements RegObserver {
    private PromotionService promotionService = new PromotionService();//依赖注入

    @Override
    public void handleRegSuccess(long userId) {

        promotionService.issueNewUserExperienceCash(userId);

//        //第一种实现异步的方式
//        Thread thread = new Thread(() -> {
//            promotionService.issueNewUserExperienceCash(userId);
//        });
//        thread.start();


//        Thread thread = new Thread(new Runnable() {
//            @Override
//            public void run() {
//                promotionService.issueNewUserExperienceCash(userId);
//            }
//        });
//        thread.start();
    }
}
